import http from './axios.config'
import store from '@/store'
import { IOptions } from '@/store/modules/base'

// 基础模块
function baseModule () {
  return store.state.base
}
// 路由参数
function getBaseOptions (): IOptions {
  return baseModule().options
}

// 系统初始化
export const ApiInit = () => {
  return http.post('/api/screen/init', {
    shopId: getBaseOptions().shopId,
    groupId: getBaseOptions().groupId
  }, {
    dface: {
      // mock: true
    }
  })
}

// 获取天气信息
export const ApiGetWeather = () => {
  return http.post('/api/screen/getWeather', {
    shopId: getBaseOptions().shopId
  }, {
    dface: {
      // mock: true
    }
  })
}

// 获取单个页面信息
export const ApiPageInfo = (navId) => {
  return http.post('/api/screen/getBody', {
    shopId: getBaseOptions().shopId,
    groupId: getBaseOptions().groupId,
    navId
  }, {
    dface: {
      // mock: true
    }
  })
}
